package com.yanfan.ccapi.service.impl;

import com.yanfan.ccapi.service.ICcapiThirdPartyActionService;
import com.yanfan.ccapicode.dao.ThirdPartyActionRepository;
import com.yanfan.ccapicode.dao.entity.ThirdPartyActionDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 语音平台动作标识Service业务层处理
 *
 * @author kerwincui
 * @date 2025-06-29
 */
@Service
public class CcapiThirdPartyActionServiceImpl implements ICcapiThirdPartyActionService {
    @Autowired
    private ThirdPartyActionRepository ccapiThirdPartyActionMapper;

    /**
     * 查询语音平台动作标识
     *
     * @param id 语音平台动作标识主键
     * @return 语音平台动作标识
     */
    @Override
    public ThirdPartyActionDO selectCcapiThirdPartyActionById(Long id) {
        return ccapiThirdPartyActionMapper.selectById(id);
    }

    /**
     * 查询语音平台动作标识列表
     *
     * @param ccapiThirdPartyAction 语音平台动作标识
     * @return 语音平台动作标识
     */
    @Override
    public List<ThirdPartyActionDO> selectCcapiThirdPartyActionList(ThirdPartyActionDO ccapiThirdPartyAction) {
        return ccapiThirdPartyActionMapper.selectByCon(ccapiThirdPartyAction);
    }

    /**
     * 新增语音平台动作标识
     *
     * @param ccapiThirdPartyAction 语音平台动作标识
     * @return 结果
     */
    @Override
    public boolean insertCcapiThirdPartyAction(ThirdPartyActionDO ccapiThirdPartyAction) {
            return ccapiThirdPartyActionMapper.insertOrUpdate(ccapiThirdPartyAction);
    }

    /**
     * 修改语音平台动作标识
     *
     * @param ccapiThirdPartyAction 语音平台动作标识
     * @return 结果
     */
    @Override
    public boolean updateCcapiThirdPartyAction(ThirdPartyActionDO ccapiThirdPartyAction) {
        return ccapiThirdPartyActionMapper.insertOrUpdate(ccapiThirdPartyAction);
    }

    /**
     * 批量删除语音平台动作标识
     *
     * @param ids 需要删除的语音平台动作标识主键
     * @return 结果
     */
    @Override
    public boolean deleteCcapiThirdPartyActionByIds(Long[] ids) {
        return ccapiThirdPartyActionMapper.deleteByIds(Arrays.asList(ids));
    }

    /**
     * 删除语音平台动作标识信息
     *
     * @param id 语音平台动作标识主键
     * @return 结果
     */
    @Override
    public boolean deleteCcapiThirdPartyActionById(Long id) {
        return ccapiThirdPartyActionMapper.deleteById(id);
    }
}
